<template>
  <a-form-item label="日期" class="trainDate">
    <a-config-provider :locale="locale">
      <a-date-picker
        v-decorator="[
          'date',
          { rules: [{ required: true, message: '请选择日期!' }] },
        ]"
        show-time
        format="YYYY-MM-DD"
        placeholder="请选择日期"
        :showToday="true"
        mode="date"
        valueFormat="YYYY-MM-DD"
        @change="changeDateTime"
        :value="value"
      />
    </a-config-provider>
  </a-form-item>
</template>

<script>
import zhCN from "ant-design-vue/es/locale/zh_CN";

export default {
  data() {
    return {
      locale: zhCN,
    };
  },
  props: ["value"],
  methods: {
    changeDateTime(dateTime) {
      this.$emit("input", dateTime);
    },
  },
};
</script>

<style scoped lang="less">
.trainDate {
  display: flex;
  margin-bottom: 0;
}
</style>